package com.woniu.controller;

import com.woniu.entity.Goods;
import com.woniu.service.GoodsService;
import com.woniu.service.impl.GoodsServiceImpl;

import java.util.List;

public class GoodsController {
    public static void insertGoods(Goods goods) {
        GoodsService goodsService = new GoodsServiceImpl();
        goodsService.insertGoods(goods);
    }

    public static Goods selectGoods(Integer pid, Integer uid) {
        GoodsService goodsService = new GoodsServiceImpl();
        return goodsService.selectGoods(pid, uid);
    }

    public static void updateGoods(Integer stock, Integer pid, Integer uid) {
        GoodsService goodsService = new GoodsServiceImpl();
        goodsService.updateGoods(stock,pid,uid);
    }

    public static List<Goods> selectAllGoods(Integer uid) {
        GoodsService goodsService = new GoodsServiceImpl();
         List<Goods> goods = goodsService.selectGoodsAll(uid);
         return goods;
    }
    public static void deleteGoodsByUid(Integer uid) {
        GoodsService goodsService = new GoodsServiceImpl();
        goodsService.deleteGoodsByUId(uid);
    }
    public static void deleteGoodsByUidPid(Integer pid, Integer uid) {
        GoodsService goodsService = new GoodsServiceImpl();
        goodsService.deleteGoodsByUidPid(pid, uid);
    }
    public static void deleteGoodsByMerchantId(Integer merchant_id){
        GoodsService goodsService = new GoodsServiceImpl();
        goodsService.deleteGoodsByMerchantId(merchant_id);
    };
}
